package com.eco.fanliapp.utils.AppWxWithdrawalUtils;

import com.eco.fanliapp.common.constant.WxWithdrawal;
import org.springframework.stereotype.Service;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

@Service
public class WXPayConfigSub extends WXPayConfig {
    String getAppID() {
        return WxWithdrawal.mchAppId;
    }

    String getMchID() {
        return WxWithdrawal.mchiId;
    }

    String getKey() {
        return WxWithdrawal.key;
    }

    InputStream getCertStream() {
        FileInputStream inputStream = null;
        try {
            inputStream = new FileInputStream(WxWithdrawal.certStream);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        return  inputStream;
    }

    IWXPayDomain getWXPayDomain() {
        IWXPayDomain iwxPayDomain = new IWXPayDomain() {
            @Override
            public void report(String domain, long elapsedTimeMillis, Exception ex) {
            }
            @Override
            public DomainInfo getDomain(WXPayConfig config) {
                return new DomainInfo(WxWithdrawal.doMain,true);
            }
        };
        return iwxPayDomain;
    }
}
